<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>现金转账</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <script src="js/rem.js"></script>
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="css/base.css"/>
    <link rel="stylesheet" type="text/css" href="css/page.css"/>
    <link rel="stylesheet" type="text/css" href="css/all.css"/>
    <link rel="stylesheet" type="text/css" href="css/mui.min.css"/>
    <link rel="stylesheet" type="text/css" href="css/loaders.min.css"/>
    <link rel="stylesheet" type="text/css" href="css/loading.css"/>
    <link rel="stylesheet" type="text/css" href="slick/slick.css"/>
    <link rel="stylesheet" type="text/css" href="css/mui.picker.min.css"/>
    <link href="css/mui.picker.css" rel="stylesheet"/>
    <script src="js/vue-2.4.0.js" type="text/javascript"></script>

    <script type="text/javascript">
        var cashByUserUrl = "../cash/getCashByUid";
        var chargeCashUrl = "../cash/chargeCash";

        $(function () {
            $(".loading").addClass("loader-chanage");
            $(".loading").fadeOut(300);

            //获取当前用户金额
            $.get(cashByUserUrl, function (result) {
                if (result.state == 1000) {
                    new Vue({
                        el: '#cash',
                        data: {
                            datas: result.data,
                            msg: result.msg
                        }
                    });
                }
            });

        })

        //发送充值请求
        function chargeCash() {
            var cashMoney = $("#cashMoney").val();
            var options = $("#sid option:selected").val();
            var params = {
                cashMoney: cashMoney,
                chargeStyle: options
            }
            if (cashMoney==null||cashMoney==""){
                alert("请填写充值金额");
            }else if(options==0){
                alert("请填写付款方式");
            }else {
                $.post(chargeCashUrl, params, function (result) {
                    if (result.state == 1000) {
                        alert("充值成功")
                    } else {
                        alert(result.msg);
                    }
                    window.location.href = "center.html?";
                });
            }
        }
    </script>
</head>
<!--loading页开始-->
<div class="loading">
    <div class="loader">
        <div class="loader-inner pacman">
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
        </div>
    </div>
</div>
<!--loading页结束-->
<body>
<!--header star-->
<header class="mui-bar mui-bar1 mui-bar-nav mui-bar-nav1" id="header">
    <a class="btn" href="javascript:history.go(-1)">
        <i class="iconfont icon-fanhui"></i>
    </a>
    <div class="top-sch-box top-sch-boxtwo top-sch-boxthree flex-col">
        返回
    </div>
</header>
<!--header end-->
<div id="cash" class="warp warpthree clearfloat">
    <div class="h-top h-topone clearfloat box-s">
        <p v-if="msg==true">{{datas.account}}</p>
        <p v-if="msg==false">0</p>
        <span>账户余额(元)</span>
    </div>
    <div class="recharge clearfloat">
        <div class="czhi clearfloat box-s">
            <p>充值金额</p>
            <input type="text" id="cashMoney" value="" placeholder="请输入金额"/>
            <span>元</span>
        </div>

        <select style="font-size: 18px;color:#333333" id="sid">
            <option value="0"> 请选择支付方式</option>
            <option value="1">翼支付</option>
            <option value="2">微信</option>
        </select>
        <!--<a href="#" class="center-btn center-btntwo db ra3">点击上传文件</a>-->
        <div class="guize clearfloat box-s ra3">
            <h3>充值规则</h3>
            <div class="content clearfloat">
                支持微信、翼支付进行充值，多多充值有惊喜哦！！！
            </div>
        </div>
        <div class="bottom clearfloat">
            <a href="#" onclick="chargeCash()" class="db fl btn ra3">确定</a>
            <a href="javascript:history.go(-1)" class="db fr btn ra3">取消</a>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script src="js/mui.min.js"></script>
<script src="js/mui.picker.min.js"></script>
<script src="js/others.js"></script>
<script type="text/javascript" src="js/hmt.js"></script>
<script src="slick/slick.js" type="text/javascript"></script>
<!--插件-->
<link rel="stylesheet" href="css/swiper.min.css">
<script src="js/swiper.jquery.min.js"></script>
</html>
